<!-- 入口 -->
<template>
  <div id="routerShengminzhouqi">
    <button @click="ifUnmountfu">销毁生命周期</button>
    <br />
    <!-- keep-alive:缓存标签 -->
    <keep-alive>
      <Shengminzhouqi v-if="ifUnmount" ref="Shengminzhouqi" title="生命周期"/>
    </keep-alive>
    <br/>
    <Shengminzhouqi v-if="ifUnmount" title="生命周期1"/>
    <br/>
    <Shengminzhouqi  title="生命周期2"/>
  </div>
</template>

<script>
import Shengminzhouqi from '../components/shengminzhouqi.vue';

export default {
  data () {
    return {
        ifUnmount:true,
    };
  },
//组件
  components: {
      Shengminzhouqi
  },
//计算
  computed: {},
//初始化
  mounted(){},
//方法
  methods: {
      ifUnmountfu(){
          this.ifUnmount?this.$refs.Shengminzhouqi.num = 20 + this.$refs.Shengminzhouqi.num:'';
          this.ifUnmount = !this.ifUnmount;
      }
  }
}

</script>
<style lang='scss' scoped>
</style>